import java.util.Calendar;


public class Event implements Comparable<Event>{

	private Calendar eventStart;
	private Calendar eventEnd;
	private String location;
	private String category;
	private String description;
	private int priority;
	private int remind;
	
	public Event()
	{
		eventStart = Calendar.getInstance();
		eventEnd = Calendar.getInstance();
		setLocation("");
		setCategory("");
		setDescription("");
	}
	
	public void setEventStart(int year,int month, int date, int hour, int minute)
	{
		this.eventStart.set(year, month, date, hour, minute);
	}
	
	public Calendar getEventStart()
	{
		return eventStart;
	}
	
	public int convertStartHour()	//konwertowanie godziny startu wydarzenia na indeks wiersza w modelu
	{
		int hour = 0;
		hour = 2*(this.eventStart.get(Calendar.HOUR_OF_DAY));
		if(this.eventStart.get(Calendar.MINUTE) == 30)
			hour = hour + 1;
		return hour;
	}
	public int convertEndHour()    //konwertowanie godziny konca wydarzenia na indeks wiersza w modelu
	{
		int hour = 0;
		hour = 2*(this.eventEnd.get(Calendar.HOUR_OF_DAY));
		if(this.eventEnd.get(Calendar.MINUTE) == 30)
			hour = hour + 1;
		return hour;
	}
	public void setEventEnd(int year,int month, int date, int hour, int minute)
	{
		this.eventEnd.set(year, month, date, hour, minute);
	}
	
	public Calendar getEventEnd()
	{
		return eventEnd;
	}
	
	public void setLocation(String location) {
		this.location = location;
	}

	public String getLocation() {
		return location;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getDescription() {
		return description;
	}

	public void setCategory(String category) {
		this.category = category;
	}

	public String getCategory() {
		return category;
	}

	public void setPriority(int priority) {
		this.priority = priority;
	}

	public int getPriority() {
		return priority;
	}
	
	public int compareTo(Event o)		//porownanie po priorytecie
	{
		if(this.priority == o.priority)
			return 0;
		else if(this.priority < o.priority)
			return -1;
		else
			return 1;
	}

	public void setRemind(int remind) {
		this.remind = remind;
	}

	public int getRemind() {
		return remind;
	}
	
	public String toString()
	{
		return "Miejsce: " + location + "Kategoria: " + category + "Opis: " + description + "Priorytet: " + priority + "Przypomnienie: " + remind;
	}
	
	public Calendar eventStartDate()	//funkcja potrzebna do porownania w Application.java
	{
		Calendar date = (Calendar)this.eventStart.clone();
		date.set(Calendar.HOUR_OF_DAY, 0);
		date.set(Calendar.MINUTE, 0);
		return date;	
	}
	public Calendar eventEndDate()		//funkcja potrzebna do porownania w Application.java
	{
		Calendar date = (Calendar)this.eventEnd.clone();
		date.set(Calendar.HOUR_OF_DAY, 0);
		date.set(Calendar.MINUTE, 0);
		return date;
	}
	
	
}
